package riceSystem.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import riceSystem.dao.DaoTemplateInterface;
import riceSystem.entity.Announcement;
import riceSystem.exception.RunException;
import riceSystem.service.ServiceTemplateInterface;
@Component("announcementService")
public class AnnouncementServiceImpl implements ServiceTemplateInterface<Announcement> {
	
	private DaoTemplateInterface<Announcement> announcementDao;
	
	public DaoTemplateInterface<Announcement> getAnnouncementDao() {
		return announcementDao;
	}
	@Resource(name="announcementDao")
	public void setAnnouncementDao(
			DaoTemplateInterface<Announcement> announcementDao) {
		this.announcementDao = announcementDao;
	}

	public void add(Announcement t) throws RunException {
		announcementDao.save(t);
	}

	public void removeById(long id) throws RunException {
		announcementDao.deleteById(id);
	}

	public void remove(Announcement t) throws RunException {
		announcementDao.delete(t);
	}

	public long update(Announcement t) throws RunException {
		return announcementDao.update(t);
	}

	public Announcement getById(long id) throws RunException {
		return announcementDao.loadById(id);
	}

	public List<Announcement> getAll() throws RunException {
		return announcementDao.loadAll();
	}

}
